package com.hdax.easybuy.controller;

import com.hdax.easybuy.dao.OrderDao;
import com.hdax.easybuy.entity.Order;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(value = "/providerOrder")
public class OrderProviderController {

    @Resource
    private OrderDao orderDao;

    @RequestMapping("/getAllOrder")
    public List<Order> queryAllOrder(){
        return orderDao.findAll();
    }

    @RequestMapping("/getOrderByUserId/{userid}")
    public List<Order> getOrderByUserId(@PathVariable("userid")int userid){
        return orderDao.findByUserId(userid);
    }


}
